//
//  TabViewICell.m
//  DemoSecond
//
//  Created by yuzhuo on 16/7/19.
//  Copyright © 2016年 yuzhuo. All rights reserved.
//

#import "HomeGraphCell.h"
#import "Constant.h"
#import "UIColor+Util.h"
@implementation HomeGraphCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self  = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if(self){
        self.accessoryType = UITableViewCellAccessoryNone;//
        [self initSubViews];
    }
    return self;
}

-(void) initSubViews
{
    self.backgroundColor = [UIColor whiteColor];
    self.avatar = [[UIImageView alloc] initWithFrame:CGRectMake(15, 0, SCREEN_WIDTH-30, 160)];
    
    
    UIFont *font_16 = [UIFont systemFontOfSize:16];
    UIFont *font_12 = [UIFont systemFontOfSize:12];
    UIFont *font_10 = [UIFont systemFontOfSize:10];
    
    self.name = [[UILabel alloc] initWithFrame:CGRectMake(15, 170, font_16.lineHeight*4, font_16.lineHeight)];
    self.name.textColor = [UIColor colorWithHexString:@"#4A4A4A"];
    self.name.font = font_16;
    
    self.job = [[UILabel alloc] initWithFrame:CGRectMake(15+font_16.lineHeight*4, 170+font_16.lineHeight-font_12.lineHeight-2, 110, font_12.lineHeight)];
    self.job.textColor = [UIColor blackColor];
    self.job.font = font_12;
    
    self.content = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-15-35, 172, 35, font_10.lineHeight)];
    self.content.textColor = [UIColor lightGrayColor];
    self.content.textColor = [UIColor colorWithHexString:@"#4A4A4A"];
    self.content.font = font_10;
    
    self.praseImage = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-80, 170, 20, 17)];

    [self.contentView addSubview:self.avatar];
    [self.contentView addSubview:self.name];
    [self.contentView addSubview:self.job];
    [self.contentView addSubview:self.praseImage];
    [self.contentView addSubview: self.content];
}

#pragma mark -SetData

-(void)setData:(CellEnity*)data
{
    _data = data;
    self.avatar.image = data.avatar;
    self.name.text = data.name;
    self.job.text = data.job;
    if(data.isParse){
        self.praseImage.image = [UIImage imageNamed:@"icon_prased"];
    }else{
        self.praseImage.image = [UIImage imageNamed:@"icon_prase"];
    }
    self.content.text = data.content;
}
@end
